﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;

namespace Spore.Utils
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            SocketAsyncEventArgs sae = new SocketAsyncEventArgs();
            //sae.SetBuffer(new byte[1000],0, 1000);
            MyClass myClass = new MyClass();
            byte[] data = BinaryFormater.FormaterObjectToBinary(myClass);
            int flag;
            myClass =(MyClass)BinaryFormater.DeformateObject(typeof(MyClass), data, 0, out flag);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }

    [CanFormat]
    public class MyClass
    {
        [FormateToBinary]
        private int? test;
        [FormateToBinary]
        private TestStruct ts;
        public MyClass()
        {
            test = 90;
            ts = new TestStruct();
            ts.ss = "daee";
            ts.ssd = 125;
            ts.strs = new string[] { "dafda", "dafasfa" };
        }
    }

    [CanFormat]
    struct TestStruct
    {
        [FormateToBinary]
        public int? ssd;
        [FormateToBinary]
        public string ss;
        [FormateToBinary]
        public string[] strs;
    }

    public class G<T>
    {
        public T t;
    }

    public class ew
    {
        public void Trs<T>(G<T> d)
        {
            
        }
    }
}
